package com.platform.hjt.erp.model;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.platform.hjt.erp.model.json.ErpStorageSerializer;
import com.platform.hjt.sys.model.SysCompanyInfo;
import com.platform.hjt.sys.model.SysUserInfo;
import com.platform.hjt.sys.model.json.SysCompanyInfoSerialize;
import com.platform.hjt.sys.model.json.SysUserInfoSerialize;

/**
 * ErpStorageFlow entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "erp_storage_flow")
public class ErpStorageFlow implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -7076240186809206783L;
	private String storageFlowId;
	private SysCompanyInfo sysCompanyInfo;
	private SysUserInfo sysUserInfo;
	@NotNull(message="请选择仓库")
	private ErpStorage erpStorage;
	private Double storageFlowTotalPrice;
	@NotBlank(message="仓库流水类型不能为空")
	private String storageFlowType;
	
	@Length(max=2000, message="备注不能超过2000字")
	private String remark;
	
	private String processId;
	private String processOrderId;
	private String taskId;
	
	private Timestamp createTime;
	private Boolean isDel;
	
	private List<ErpStorageFlowDetail> detailList = new ArrayList<ErpStorageFlowDetail>();

	// Constructors

	/** default constructor */
	public ErpStorageFlow() {
	}

	public ErpStorageFlow(String storageFlowId) {
		this.storageFlowId = storageFlowId;
	}
	
	/** minimal constructor */
	public ErpStorageFlow(String storageFlowId, ErpStorage erpStorage) {
		this.storageFlowId = storageFlowId;
		this.erpStorage = erpStorage;
	}

	/** full constructor */
	public ErpStorageFlow(String storageFlowId, SysCompanyInfo sysCompanyInfo,
			SysUserInfo sysUserInfo, ErpStorage erpStorage,
			Double storageFlowTotalPrice, String storageFlowType,
			Timestamp createTime, Boolean isDel) {
		this.storageFlowId = storageFlowId;
		this.sysCompanyInfo = sysCompanyInfo;
		this.sysUserInfo = sysUserInfo;
		this.erpStorage = erpStorage;
		this.storageFlowTotalPrice = storageFlowTotalPrice;
		this.storageFlowType = storageFlowType;
		this.createTime = createTime;
		this.isDel = isDel;
	}

	// Property accessors
	@Id
	@GenericGenerator(name="systemUUID",strategy="uuid")
	@GeneratedValue(generator="systemUUID")
	@Column(name = "storage_flow_id", unique = true, nullable = false, length = 32)
	public String getStorageFlowId() {
		return this.storageFlowId;
	}

	public void setStorageFlowId(String storageFlowId) {
		this.storageFlowId = storageFlowId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_company_info_id")
	@JsonSerialize(using = SysCompanyInfoSerialize.class)
	public SysCompanyInfo getSysCompanyInfo() {
		return this.sysCompanyInfo;
	}

	public void setSysCompanyInfo(SysCompanyInfo sysCompanyInfo) {
		this.sysCompanyInfo = sysCompanyInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_user_info_id")
	@JsonSerialize(using = SysUserInfoSerialize.class)
	public SysUserInfo getSysUserInfo() {
		return this.sysUserInfo;
	}

	public void setSysUserInfo(SysUserInfo sysUserInfo) {
		this.sysUserInfo = sysUserInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "erp_storage_id", nullable = false)
	@JsonSerialize(using = ErpStorageSerializer.class)
	public ErpStorage getErpStorage() {
		return this.erpStorage;
	}

	public void setErpStorage(ErpStorage erpStorage) {
		this.erpStorage = erpStorage;
	}

	@Column(name = "storage_flow_total_price", precision = 22, scale = 0)
	public Double getStorageFlowTotalPrice() {
		return this.storageFlowTotalPrice;
	}

	public void setStorageFlowTotalPrice(Double storageFlowTotalPrice) {
		this.storageFlowTotalPrice = storageFlowTotalPrice;
	}

	@Column(name = "storage_flow_type", length = 1)
	public String getStorageFlowType() {
		return this.storageFlowType;
	}

	public void setStorageFlowType(String storageFlowType) {
		this.storageFlowType = storageFlowType;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Column(name = "is_del")
	public Boolean getIsDel() {
		return this.isDel;
	}

	public void setIsDel(Boolean isDel) {
		this.isDel = isDel;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Transient
	public List<ErpStorageFlowDetail> getDetailList() {
		return detailList;
	}

	public void setDetailList(List<ErpStorageFlowDetail> detailList) {
		this.detailList = detailList;
	}

	@Column(name = "process_id")
	public String getProcessId() {
		return processId;
	}

	public void setProcessId(String processId) {
		this.processId = processId;
	}

	@Column(name = "process_order_id")
	public String getProcessOrderId() {
		return processOrderId;
	}

	public void setProcessOrderId(String processOrderId) {
		this.processOrderId = processOrderId;
	}

	@Column(name = "task_id")
	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}

}